import { getListAll } from '/@/api/cuisine/cuisineType';
import { getListAll as unitGetListAll } from '/@/api/cuisine/unit';
import { FormSchema } from '/@/components/Table';

export const cuisineFormSchema: FormSchema[] = [
  {
    label: '菜品图片',
    field: 'firstImgUrl',
    slot: 'firstImgUrlSlot',
    component: 'Input',
    /* component: 'Upload',
    componentProps: {
      multiple: false,
      emptyHidePreview:true,
      api: uploadApi,
      uploadParams: { bizPath: 'cuisine' },
    },*/
    required: false,
  },
  {
    label: '菜品名称',
    field: 'name',
    component: 'Input',
    required: true,
  },
  {
    label: '菜品分类',
    field: 'cuisineTypeId',
    component: 'ApiSelect',
    componentProps: {
      immediate: false,
      api: getListAll,
      params: { type: 1 },
      labelField: 'name',
      valueField: 'id',
    },
    required: true,
  },
  {
    label: '单位',
    field: 'unitId',
    component: 'ApiSelect',
    componentProps: {
      immediate: false,
      api: unitGetListAll,
      params: { type: 1 },
      labelField: 'name',
      valueField: 'id',
    },
    required: false,
  },
  {
    label: '价格',
    field: 'money',
    // slot: 'priceSlot',
    component: 'InputNumber',
    required: false,
  },
  {
    label: '规格',
    field: 'specs',
    slot: 'specsSlot',
    component: 'InputNumber',
    required: false,
  },
  {
    label: '做法',
    field: 'practice',
    slot: 'practiceSlot',
    component: 'InputNumber',
    required: false,
  },
  /* {
    label: '加料',
    field: 'feed',
    slot: 'feed',
    component: 'InputNumber',
    required: true,
  },*/
  {
    label: '状态',
    field: 'state',
    defaultValue: 1,
    component: 'RadioGroup',
    componentProps: {
      defaultValue: 1,
      options: [
        {
          label: '在售',
          value: 1,
        },
        {
          label: '停用',
          value: 2,
        },
      ],
    },
    required: true,
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
  },
];
